logo of company

Where we analyse the effect of a factor on local diversity

Author: Adrien Taudière

Date: October 29, 2024

See the documentation of the MiscMetabar package for example of alpha diversity analysis.

Code
if(base::interactive()) {
  params <- rmarkdown::yaml_front_matter(here::here("analysis/03_beta_diversity.qmd"))$params
}
factor_of_interest <- params$factor_of_interest
Code
library(knitr)
library(targets)
library(MiscMetabar)
here::i_am("analysis/02_alpha_diversity.qmd")
source(here::here("R/styles.R"))
Code
d_pq <- clean_pq(tar_read("d_vs", store=here::here("_targets/")))
Cleaning suppress 2 taxa and 1 samples.
Code
hill_pq(subset_samples(d_pq, Type %in% c("Mix", "Mono")), factor_of_interest, one_plot = TRUE) &
  (
    theme_idest(
      subtitle_size = 8,
      plot_title_size = 12,
      plot_margin = margin(5, 10, 5, 10),
      axis_title_size = 9,
      axis_text_size = 8
    ) + theme(legend.position = "none")
  ) 
Taxa are now in rows.
3 out of 3 Hill scales do not show any global trends with you factor Type. Tuckey HSD plot is not informative for those Hill scales. Letters are not printed for those Hill scales

Code
MiscMetabar::accu_plot_balanced_modality(d_pq, factor_of_interest, nperm=20) + theme_idest()
`set.seed(1)` was used to initialize repeatable random subsampling.
Please record this for your records so others can reproduce.
Try `set.seed(1); .Random.seed` for the full vector
...
Warning in rarefy_sample_count_by_modality(rarefy_even_depth(physeq, rngseed = 1, : The number of final levels (sam_data of the output phyloseq
                    object) is not equal to the inital (sam_data of the input
                    phyloseq object) number of levels in the  factor: 'Type'
Warning in max(dff$xlab, na.rm = TRUE): aucun argument pour max ; -Inf est
renvoyé

  |                                                        
  |                                                  |   0%
  |                                                        
  |==                                                |   5%
  |                                                        
  |=====                                             |  10%
Error in plist[, , i] <- as.matrix(suppressWarnings(suppressMessages(accu_plot(rarefy_sample_count_by_modality(rarefy_even_depth(physeq, : le nombre d'objets à remplacer n'est pas multiple de la taille du remplacement
Code
ggbetween_pq(d_pq, factor_of_interest)
$plot_Hill_0


$plot_Hill_1


$plot_Hill_2

Session Information

Session information are detailed below. More information about the machine, the system, as well as python and R packages, are available in the file data_final/information_run.txt .

Code
sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Debian GNU/Linux 12 (bookworm)

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Paris
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] MiscMetabar_0.10.1 purrr_1.0.2        dplyr_1.1.4        dada2_1.32.0      
[5] Rcpp_1.0.13        ggplot2_3.5.1      phyloseq_1.48.0    targets_1.8.0     
[9] knitr_1.48        

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3          jsonlite_1.8.9             
  [3] datawizard_0.13.0           correlation_0.8.5          
  [5] magrittr_2.0.3              SuppDists_1.1-9.8          
  [7] farver_2.1.2                rmarkdown_2.28             
  [9] zlibbioc_1.50.0             vctrs_0.6.5                
 [11] multtest_2.60.0             memoise_2.0.1              
 [13] Rsamtools_2.20.0            paletteer_1.6.0            
 [15] effectsize_0.8.9            htmltools_0.5.8.1          
 [17] S4Arrays_1.4.1              BWStest_0.2.3              
 [19] Rhdf5lib_1.26.0             SparseArray_1.4.8          
 [21] rhdf5_2.48.0                htmlwidgets_1.6.4          
 [23] plyr_1.8.9                  cachem_1.1.0               
 [25] GenomicAlignments_1.40.0    igraph_2.1.1               
 [27] lifecycle_1.0.4             iterators_1.0.14           
 [29] pkgconfig_2.0.3             Matrix_1.7-0               
 [31] R6_2.5.1                    fastmap_1.2.0              
 [33] PMCMRplus_1.9.12            GenomeInfoDbData_1.2.12    
 [35] MatrixGenerics_1.16.0       BayesFactor_0.9.12-4.7     
 [37] digest_0.6.37               colorspace_2.1-1           
 [39] ShortRead_1.62.0            rematch2_2.1.2             
 [41] patchwork_1.3.0             S4Vectors_0.42.1           
 [43] ps_1.8.0                    rprojroot_2.0.4            
 [45] prismatic_1.1.2             GenomicRanges_1.56.2       
 [47] base64url_1.4               hwriter_1.3.2.1            
 [49] vegan_2.6-8                 labeling_0.4.3             
 [51] fansi_1.0.6                 httr_1.4.7                 
 [53] abind_1.4-8                 mgcv_1.9-1                 
 [55] compiler_4.4.1              here_1.0.1                 
 [57] withr_3.0.1                 backports_1.5.0            
 [59] BiocParallel_1.38.0         performance_0.12.4         
 [61] ggsignif_0.6.4              MASS_7.3-61                
 [63] DelayedArray_0.30.1         biomformat_1.32.0          
 [65] permute_0.9-7               tools_4.4.1                
 [67] ape_5.8                     statsExpressions_1.6.0     
 [69] glue_1.8.0                  callr_3.7.6                
 [71] nlme_3.1-165                rhdf5filters_1.16.0        
 [73] grid_4.4.1                  cluster_2.1.6              
 [75] reshape2_1.4.4              ade4_1.7-22                
 [77] generics_0.1.3              gtable_0.3.5               
 [79] tidyr_1.3.1                 data.table_1.16.2          
 [81] utf8_1.2.4                  XVector_0.44.0             
 [83] BiocGenerics_0.50.0         ggrepel_0.9.6              
 [85] foreach_1.5.2               pillar_1.9.0               
 [87] stringr_1.5.1               splines_4.4.1              
 [89] lattice_0.22-6              gmp_0.7-5                  
 [91] renv_1.0.11                 survival_3.7-0             
 [93] deldir_2.0-4                ggstatsplot_0.12.4         
 [95] tidyselect_1.2.1            pbapply_1.7-2              
 [97] Biostrings_2.72.1           IRanges_2.38.1             
 [99] SummarizedExperiment_1.34.0 stats4_4.4.1               
[101] xfun_0.48                   Biobase_2.64.0             
[103] matrixStats_1.4.1           stringi_1.8.4              
[105] UCSC.utils_1.0.0            yaml_2.3.10                
[107] kSamples_1.2-10             evaluate_1.0.1             
[109] codetools_0.2-20            interp_1.1-6               
[111] tibble_3.2.1                BiocManager_1.30.25        
[113] multcompView_0.1-10         cli_3.6.3                  
[115] RcppParallel_5.1.9          secretbase_1.0.3           
[117] parameters_0.23.0           munsell_0.5.1              
[119] processx_3.8.4              GenomeInfoDb_1.40.1        
[121] zeallot_0.1.0               coda_0.19-4.1              
[123] png_0.1-8                   parallel_4.4.1             
[125] MatrixModels_0.5-3          bayestestR_0.15.0          
[127] latticeExtra_0.6-30         jpeg_0.1-10                
[129] bitops_1.0-9                Rmpfr_0.9-5                
[131] pwalign_1.0.0               mvtnorm_1.3-1              
[133] scales_1.3.0                insight_0.20.5             
[135] crayon_1.5.3                rlang_1.1.4                

Citation

BibTeX citation:
@online{taudière2024,
  author = {Taudière, Adrien},
  title = {Alpha-Diversity},
  date = {2024-10-29},
  langid = {en}
}
For attribution, please cite this work as:
Taudière, Adrien. 2024. “Alpha-Diversity.” October 29, 2024.